package com.paincupid.springmvc;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class T {
	public static int a = 1;
	public int countA(){
		a = a+1;
		return a;
	}
	public void getA(){
		System.out.println(a);
		
	}
	
	public static void test(int num) {
        int[][] array = new int[num][num];
        int i = 0, j = 0, k = 1, m = 1;
        for(int n = 0; n < num * num; n++){
            array[i][j] = n + 1;
            if (k % 2 != 0){
                if (j + m > num - 1 - k / 4 || j + m < k / 4){
                    k++;
                    i += m;
                    continue;
                }
                j += m;
            }else{
                if (i + m > num - 1 - k / 4 || i + m < k / 4){
                    k++;
                    m = -m;
                    j += m;
                    continue;
                }
                i += m;
            }
        }
        for(int s = 0; s < num; s++){
            System.out.println(Arrays.toString(array[s]));
        }
    }
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Map mh = new HashMap();
//		Collection c;
		//HashSet set = new HashSet<E>();
		String a = new String();
		
		
		
		//java.util.concurrent.
		T t1 = new T();
		t1.countA();
		t1.countA();
		t1.getA();
		T t2 = new T();
		t2.getA();
		
		new T().test(5);
	}
	
	

}
